<?php

/**
 * Unidmedida form base class.
 *
 * @method Unidmedida getObject() Returns the current form's model object
 *
 * @package    aeropostal
 * @subpackage form
 * @author     Your name here
 */
abstract class BaseUnidmedidaForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'simbolo' => new sfWidgetFormInputHidden(),
      'nombre'  => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'simbolo' => new sfValidatorChoice(array('choices' => array($this->getObject()->getSimbolo()), 'empty_value' => $this->getObject()->getSimbolo(), 'required' => false)),
      'nombre'  => new sfValidatorString(array('max_length' => 255)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorAnd(array(
        new sfValidatorPropelUnique(array('model' => 'Unidmedida', 'column' => array('simbolo'))),
        new sfValidatorPropelUnique(array('model' => 'Unidmedida', 'column' => array('nombre'))),
      ))
    );

    $this->widgetSchema->setNameFormat('unidmedida[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Unidmedida';
  }


}
